var app = getApp();

Page({
  data: {
    userId: null
  },
  onLoad(query) {
    console.log(query)
    this.setData({
      userId: query.userId
    })
  },
  publishExpress(e){
    console.log(e)
    dd.httpRequest({
      url: app.globalData.url + '/express/add',
      method: 'POST',
      data: {
        publishId: this.data.userId,
        expressCompany: e.detail.value.expressCompany,
        expressContact: e.detail.value.expressContact,
        expressMessage: e.detail.value.expressMessage,
        expressNote: e.detail.value.expressNote,
        expressPhone: e.detail.value.expressPhone,
        expressReward: e.detail.value.expressReward,
        expressSite: e.detail.value.expressSite
      },
      dataType: 'json',
      success: (res) => {
        console.log('success----', res)
        dd.showToast({
          type: 'success',
          content: '发布成功',
          duration: 2000,
          success: () => {
            dd.switchTab({
              url: '/pages/order/order'
            })
          }
        })
      },
      fail: (res) => {
        console.log("httpRequestFail---", res)
        dd.alert({ content: JSON.stringify(res) });
      },
      complete: (res) => {
      }
    });
  }
});
